package com.sesame;

import com.alibaba.fastjson.JSON;
import com.github.kevinsawicki.http.HttpRequest;

import java.io.File;
import java.util.Map;

public class Test {
    public static void main(String[] args) {
        File input = new File("D:\\timg.jpg");

        String url = "http://127.0.0.1:8072/fms/index/upload_file";

        HttpRequest request = HttpRequest.post(url);
//        request.part("file", "timg.jpg", "multipart/form-data; boundary=11mlick123123", input);
        request.part("file", "timg.jpg", "multipart/form-data;", input);
        request.part("projectName", "fms");
        request.part("moduleName", "test");
        String result = request.body();

        System.out.println(result);
        Map map = JSON.parseObject(result, Map.class);
        map = JSON.parseObject(map.get("result").toString(), Map.class);
        System.out.println(map.get("src"));
    }
}
